package org.xlin.biz.service.repast;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.xlin.biz.dao.repast.RepastDao;

/**
 * 
 * 就餐记录管理逻辑处理类
 * @author xl
 *
 */
@Service
public class RepastService {
	
	@Resource
	RepastDao repastDao;
	
	/**
	 * 分页查询就餐记录列表
	 * @param pageable
	 * @param condition
	 * @return
	 */
	public Page<Map<String, Object>> queryRecord4Page(Pageable pageable, Map<String, Object> condition){
		return repastDao.queryRecord4Page(pageable, condition);
	}
	
	/**
	 * 增加就餐记录
	 * @param condition
	 * @return
	 */
	public int addRecord(Map<String,Object> condition){
		return repastDao.addRecord(condition);
	}
	
	/**
	 * 判定是否已有未结账餐单
	 * @param condition
	 * @return
	 */
	public boolean hasNoPayRepast(Map<String,Object> condition){
		return repastDao.hasNoPayRepast(condition);
	}
	
	/**
	 * 更新就餐记录
	 * @param condition
	 * @return
	 */
	public int modfiyRecord(Map<String,Object> condition){
		return repastDao.modfiyRecord(condition);
	}
	
	/**
	 * 删除就餐记录
	 * @param condition
	 * @return
	 */
	public void deleteRecord(Map<String,Object> condition){
		repastDao.deleteRecord(condition);
	}
	
	/**
	 * 增加就餐菜单记录
	 * @param condition
	 * @return
	 */
	public void addMenuRecord(List<Map<String,Object>> params) {
		repastDao.addMenuRecord(params);
	}
	
	/**
	 * 更新就餐菜单记录
	 * @param condition
	 * @return
	 */
	public int modfiyMenuRecord(Map<String,Object> condition){
		return repastDao.modfiyMenuRecord(condition);
	}
	
	/**
	 * 删除就餐菜单记录
	 * @param condition
	 * @return
	 */
	public void deleteMenuRecord(Map<String,Object> condition){
		repastDao.deleteMenuRecord(condition);
	}
	
	/**
	 * 获取就餐总金额
	 * @param repastId
	 * @return
	 */
	public BigDecimal getRepastTotal(int repastId){
		return repastDao.getRepastTotal(repastId);
	}
	
	/**
	 * 获取需要处理的菜单
	 * @return
	 */
	public List<Map<String,Object>> queryToDoMenus(){
		return repastDao.queryToDoMenus();
	}
	
	/**
	 * 变更菜单状态为已处理
	 * @param condition
	 * @return
	 */
	public int modifyMenusDoState(Map<String,Object> condition){
		return repastDao.modifyMenusDoState(condition);
	}
	
}
